<template>
  <div class="box">
    <div class="content">
      <!-- 面包屑组件 -->
      <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
        <span class="back" @click="goBack()">返回上一页</span>
        <!-- <el-breadcrumb-item>
        <span class="span">项目管理</span>
      </el-breadcrumb-item>
      <el-breadcrumb-item>
        <span class="span" style="color: #666">跨境驿</span>
      </el-breadcrumb-item>
      <el-breadcrumb-item>
        <span class="span" style="color: #666">项目详情</span>
      </el-breadcrumb-item> -->
      </el-breadcrumb>
      <!-- 一楼 -->
      <div class="f1" v-if="data">
        <div class="title">
          <p>{{ data.oderid }}</p>
          <h5 v-if="data.status">{{ data.status }}</h5>
        </div>
        <!-- 产品信息 -->
        <div class="details">
          <div class="details-item">
            <div class="details-item-left">
              <ul>
                <li>产品名称：</li>
              </ul>
              <div>
                <p>{{ data.productname }}</p>
              </div>
            </div>
            <div class="details-item-left">
              <ul>
                <li>申请日期：</li>
              </ul>
              <div>
                <p>{{ getDate(data.inputdate) }}</p>
              </div>
            </div>
            <div class="details-item-left">
              <ul>
                <li>金融机构：</li>
              </ul>
              <div>
                <p style="width: 220px">
                  {{ getData(data.Funder) }}
                </p>
              </div>
            </div>
          </div>
          <div class="details-item">
            <div class="details-item-left">
              <ul>
                <li>授信额度（元）：</li>
              </ul>
              <div>
                <p
                  v-if="data.status === '审批中' || data.status === '审批拒绝'"
                >
                  -
                </p>
                <p v-else>{{ getArea(data.amount) }}</p>
              </div>
            </div>
            <div class="details-item-left">
              <ul>
                <li>授信起始日期：</li>
              </ul>
              <div>
                <p>{{ getDate(data.startdate) }}</p>
              </div>
            </div>
            <div class="details-item-left">
              <ul>
                <li>授信结束日期：</li>
              </ul>
              <div>
                <p style="width: 220px">
                  {{ getDate(data.enddate) }}
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- 二楼 -->

      <div class="f2" v-if="data">
        <!-- 审批拒绝显示 -->
        <div class="null" v-if="data.status == '审批拒绝'">
          <img src="../../../assets/PC/金融服务/暂无记录.png" alt="" />
          <span>您的授信申请审批未通过 </span>
          <span>
            您可联系人工客服或
            <i @click="goCrossBorder()">申请其他产品</i></span
          >
        </div>
        <!-- 顶部标签 -->
        <template v-else>
          <!-- 顶部标签 -->
          <div class="title">
            <h3>项目信息</h3>
          </div>
          <div class="f2-f2">
            <h2 id="box1">申请信息</h2>
            <div class="details-item">
              <div class="details-item-left">
                <ul style="width: 180px; position: relative">
                  <li>企业实际控制人姓名：</li>
                  <li>企业实际控制人身份证号：</li>
                  <li>企业实际控制人手机号：</li>
                  <li>经办人姓名：</li>
                  <li>经办人身份证号：</li>
                  <li>经办人手机号：</li>
                  <li>退税专用账号：</li>
                  <li>退税账户开户行：</li>
                  <li>当期财报年份：</li>
                </ul>
                <div>
                  <p>{{ getData(kjApplyInfo.entcontrollerneme) }}</p>
                  <p>{{ getData(kjApplyInfo.certid) }}</p>
                  <p>{{ getData(kjApplyInfo.entcontrollephone) }}</p>
                  <p>{{ getData(kjApplyInfo.agentname) }}</p>
                  <p>{{ getData(kjApplyInfo.agentid) }}</p>
                  <p>{{ getData(kjApplyInfo.agentphone) }}</p>
                  <p>{{ getData(kjApplyInfo.drawbackaccount) }}</p>
                  <p>{{ getData(kjApplyInfo.drawbackopening) }}</p>
                  <p>{{ kjApplyInfo.particularyear }}</p>
                </div>
              </div>
              <div class="details-item-left">
                <ul style="width: 280px; position: relative">
                  <li>企业本年度累计销售收入金额（元）：</li>
                  <li>企业本年度累计缴纳增值税金额（元）：</li>
                  <li>企业上年度销售收入金额（元）：</li>
                  <li>企业上年度缴纳增值税金额（元）：</li>
                  <li>企业上上年度销售收入金额（元）：</li>
                  <li>企业上上年度缴纳增值税金额（元）：</li>
                  <li>企业当期年报营业收入（元）：</li>
                  <li>企业上期年报营业收入（元）：</li>
                  <li>企业当期年度资产合计（元）：</li>
                  <li>企业上期年度资产合计（元）：</li>
                </ul>
                <div>
                  <p>{{ getArea(kjApplyInfo.currenamount) }}</p>
                  <p>{{ getArea(kjApplyInfo.currentvatamount) }}</p>
                  <p>{{ getArea(kjApplyInfo.lastamount) }}</p>
                  <p>{{ getArea(kjApplyInfo.lastvatamount) }}</p>
                  <p>{{ getArea(kjApplyInfo.lastlastamount) }}</p>
                  <p>{{ getArea(kjApplyInfo.lastlastvatamount) }}</p>
                  <p>{{ getArea(kjApplyInfo.currentoperatingreceipt) }}</p>
                  <p>{{ getArea(kjApplyInfo.lastoperatingreceipt) }}</p>
                  <p>{{ getArea(kjApplyInfo.currentasset) }}</p>
                  <p>{{ getArea(kjApplyInfo.periodasset) }}</p>
                </div>
              </div>
            </div>
            <h2 id="box2">申请资料</h2>
            <el-table
              :data="applyData"
              border
              highlight-current-row
              stripe
              type="index"
              style="width: 100%"
              :header-cell-style="{
                background: '#f3f3f3',
                color: '#4D4D4D',
              }"
            >
              <!-- <el-table-column type="selection" min-width="6%" align="center">
          </el-table-column> -->
              <el-table-column
                prop="number"
                label="序号"
                min-width="3%"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="name"
                label="文件名称"
                min-width="20%"
                align="center"
              >
              </el-table-column>
              <el-table-column label="操作" min-width="5%" align="center">
                <template #default="scope">
                  <span
                    class="span"
                    @click="checkApply(scope.$index, applyData)"
                    type="text"
                    size="small"
                  >
                    查看
                  </span>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </template>
      </div>
    </div>

    <!-- 弹窗 -->
    <!-- 查看图片信息 -->
    <el-dialog
      title="申请资料"
      v-model="contractCardbackVisible"
      width="40%"
      center
    >
      <!-- 内容区域 -->
      <div
        v-viewer
        v-if="FileImg != ''"
        style="text-align: center; width: 300px; heigth: 300px"
        class="dialog-center"
        @click="contractCardbackVisible = false"
      >
        <img
          style="width: 100%; heigth: 100%; margin-bottom: 15px"
          :src="FileImg"
          alt=""
        />
        <p style="margin-top: 20px">点击图片可查看大图</p>
      </div>

      <div
        v-else
        style="text-align: center; margin-bottom: 30px"
        class="dialog-center"
      >
        <h4>暂无详细资料</h4>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { findkjgs, getFilePath } from "@/utils";
import {
  AreaDispose,
  dateDispose,
  dataDispose,
  statuDispose,
  unitDispose,
} from "@/utils/filters.js";
export default {
  data() {
    return {
      contractCardbackVisible: false,
      FileImg: "", //图片
      //产品数据
      row: 1,
      id: "", //项目id
      data: null,
      kjApplyInfo: {},
      // 申请文件表格数据
      applyData: [
        {
          number: 1,
          name: "统一社会信用代码证",
        },
        {
          number: 2,
          name: "对外贸易经营者备案登记表",
        },
        {
          number: 3,
          name: "出口货物退（免）税认定表",
        },
        {
          number: 4,
          name: "开户许可证",
        },
      ],
    };
  },
  mounted() {
    // 获取地址栏中的id
    this.id = this.$route.query.id;
    this.findkjgs();
  },

  methods: {
    // 金额处理
    getArea(value) {
      return AreaDispose(value);
    },
    // 时间处理
    getDate(value) {
      return dateDispose(value);
    },
    // 数据处理 为空显示为 -
    getData(value) {
      return dataDispose(value);
    },
    // 下载清单文件
    download() {
      const a = document.createElement("a"); // 动态创建a标签，防止下载大文件时，用户没看到下载提示连续点击
      a.setAttribute("target", "_blank");
      a.href = "https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe";
      a.click();
    },
    // 获取详情
    async findkjgs() {
      let { data } = await findkjgs(this.id);
      this.data = data;
      this.kjApplyInfo = data.kjApplyInfo;
    },
    // 返回上一页
    goBack() {
      this.$router.push("/projectCrossBorder");
    },
    // 返回产品列表
    goCrossBorder() {
      this.$router.push("/crossBorder");
      setTimeout(() => {
        this.$router.go(0);
      }, 500);
    },
    //查看图片详情
    async checkApply(index, row) {
      let applyid = this.data.applyid;
      let { data } = await getFilePath(applyid);
      for (let i = 0; i < data.length; i++) {
        if (data[i].name == row[index].name) {
          this.contractCardbackVisible = true;
          this.FileImg = data[i].path;
        }
      }
    },
    //防止地址栏变化
    changeHash(idName) {
      document.querySelector(idName).scrollIntoView(true);
    },
  },
};
</script>

<style lang="scss" scoped>
.box {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  // 返回上一页
  .back {
    position: absolute;
    cursor: pointer;
    left: 0px;
    font-size: 16px;
    color: #0a7be0;
    text-decoration: underline;
    user-select: none;
  }
  // 面包屑
  .breadcrumb {
    display: flex;
    align-items: center;
    height: 24px;
    .icon {
      margin: 0 10px 0 4px;
    }
    .span {
      font-size: 16px;
      font-family: Source Han Sans SC;
      font-weight: 400;
      color: #999999;
    }
  }

  .f1 {
    box-sizing: border-box;
    width: 100%;
    background: #ffffff;
    box-shadow: 0px 1px 10px 0px rgba(196, 196, 196, 0.15);
    // border-radius: 6px;
    margin: 15px 0 10px 0;
    padding: 20px 30px;

    .title {
      display: flex;
      align-items: center;
      width: 100%;
      height: 24px;
      p {
        font-size: 20px;
        font-family: Source Han Sans SC;
        font-weight: 400;
        color: #333333;
      }
      h5 {
        width: 66px;
        height: 18px;
        background: #3cb0ff;
        border-radius: 2px;
        font-size: 14px;
        font-family: Source Han Sans SC;
        font-weight: 400;
        color: #ffffff;
        text-align: center;
        line-height: 18px;
        margin-left: 8px;
      }
      span {
        font-size: 14px;
        margin-left: 60px;
      }
    }
    // <!-- 产品详细信息开始 -->
    .details {
      width: 100%;
      margin-left: 10px 10px;
      .details-item {
        display: flex;
        width: 100%;

        .details-item-left {
          display: flex;
          width: 33%;
          height: 100%;
          ul {
            width: 190px;
            height: 100%;
            font-size: 17px;
            font-family: Source Han Sans SC;
            font-weight: 400;
            color: #999999;
            li {
              margin-top: 20px;
              height: 30px;
              background-color: #fff;
            }
          }
          div {
            width: 170px;
            height: 100%;
            margin-left: 12px;
            p {
              height: 30px;
              font-size: 17px;
              font-family: Source Han Sans SC;
              font-weight: 400;
              color: #4d4d4d;
              margin-top: 20px;
            }
          }
        }
      }
    }
  }

  .f2 {
    box-sizing: border-box;
    background: #ffffff;
    box-shadow: 0px 1px 10px 0px rgba(196, 196, 196, 0.15);
    // border-radius: 6px;
    padding: 20px 20px;
    scroll-behavior: smooth;
    .null {
      box-sizing: border-box;
      border-radius: 6px;
      padding: 10px 20px;
      scroll-behavior: smooth;
      display: flex;
      flex-direction: column;
      align-items: center;
      img {
        margin-top: 50px;
        @media only screen and (min-width: 1580px) and (max-width: 1950px) {
          margin-top: 140px;
        }
        width: 326px;
        height: 212px;
      }
      span {
        font-size: 14px;
        margin-top: 10px;
        i,
        a {
          color: #0a7be0;
          text-decoration: underline;
          cursor: pointer;
        }
      }
    }
    .title {
      display: flex;
      align-items: center;
      width: 100%;
      height: 60px;
      z-index: 99;
      h3 {
        height: 32px;
        width: 75px;
        line-height: 28px;
        text-align: center;
        box-sizing: border-box;
        margin-left: 15px;
        font-size: 16px;
        font-family: Source Han Sans SC;
        font-weight: 400;
        color: #838383;
        cursor: pointer;
        box-sizing: border-box;
        border-bottom: 2px solid #0a7be0;
      }
    }
    .f2-f2 {
      width: 100%;
      // height: 280px;
      // @media only screen and (min-width: 1580px) and (max-width: 1950px) {
      //   height: 530px;
      // }
      // overflow: auto;
      scroll-behavior: smooth;
    }
    .f2-f2::-webkit-scrollbar {
      width: 5px;
      height: 10px;
      background-color: #fff;
    }

    .f2-f2::-webkit-scrollbar-thumb {
      border-radius: 2px;
      background: rgba(36, 143, 172, 0.5);
    }
    .enquiry {
      display: flex;
      margin: 10px 15px;

      .enquiry-item {
        display: flex;
        width: 48%;
        height: 100%;
        ul {
          width: 170px;
          height: 100%;
          font-size: 15px;
          font-family: Source Han Sans SC;
          font-weight: 400;
          color: #999999;
          li {
            margin-top: 10px;
            height: 30px;
            background-color: #fff;
          }
        }
        div {
          width: 180px;
          height: 100%;
          margin-left: 15px;
          p {
            height: 30px;
            font-size: 15px;
            font-family: Source Han Sans SC;
            font-weight: 400;
            color: #4d4d4d;
            margin-top: 10px;
          }
        }
      }
    }
    h2 {
      font-size: 16px;
      font-family: Source Han Sans SC;
      font-weight: 400;
      color: #333;
      margin: 15px 15px 10px 15px;
    }
    // 基本信息
    .details-item {
      display: flex;
      margin: 10px 15px;
      .details-item-left {
        display: flex;
        width: 49%;
        height: 100%;
        ul {
          width: 320px;
          height: 100%;
          font-size: 15px;
          font-family: Source Han Sans SC;
          font-weight: 400;
          color: #999999;
          li {
            margin-top: 20px;
            height: 30px;
            background-color: #fff;
          }
        }
        div {
          width: 135px;
          height: 100%;
          margin-left: 15px;
          p {
            height: 30px;
            font-size: 15px;
            font-family: Source Han Sans SC;
            font-weight: 400;
            color: #4d4d4d;
            margin-top: 20px;
          }
        }
      }
    }
    // 表格编辑/查看
    .span {
      display: inline-block;
      width: 30px;
      height: 24px;
      font-size: 14px;
      font-family: Source Han Sans SC;
      font-weight: 400;
      color: #0a7be0;
      border-bottom: 1px solid #0a7be0;
      cursor: pointer;
    }
  }
  .f2::-webkit-scrollbar {
    width: 5px;
    height: 10px;
    background-color: #fff;
  }

  .f2::-webkit-scrollbar-thumb {
    border-radius: 2px;
    background: rgba(36, 143, 172, 0.5);
  }
  // 弹出框
  .dialog-center {
    width: 90%;
    margin: 0 auto;
  }
  .dialog-footer {
    display: flex;
    justify-content: space-evenly;
    width: 70%;
    margin: 0 auto;
    .dialog-footer-bnt {
      width: 121px;
      height: 31px;
      color: #0a7be0;
      border: 1px solid #0a7be0;
      border-radius: 4px;
      background-color: #fff;
    }
    .btn2 {
      color: #fff;
      background-color: #0a7be0;
    }
  }
  .abc {
    width: 368px;
    .el-select {
      width: 100%;
    }
  }
  .el-form-item {
    margin-bottom: 15px;
    .file {
      font-size: 15px;
      margin-right: 10px;
      color: #0a7be0;
      text-decoration: underline;
      cursor: pointer;
    }
    .file1 {
      color: #999;
    }
  }
  // 弹出框
  .dialog-center {
    margin: 0 auto;
    width: 90%;
  }
  .dialog-footer {
    display: flex;
    justify-content: space-evenly;
    width: 70%;
    margin: 0 auto;
    .dialog-footer-bnt {
      width: 121px;
      height: 31px;
      color: #0a7be0;
      border: 1px solid #0a7be0;
      border-radius: 4px;
      background-color: #fff;
    }
    .btn2 {
      color: #fff;
      background-color: #0a7be0;
    }
  }
  .abc {
    width: 368px;
    .el-select {
      width: 100%;
    }
  }
  .dialog-center-hint {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 20px;
  }
}
.content {
  margin: 0 auto;
  position: relative;
  width: 960px;
}
/* 输入框样式  */
::v-deep(.el-input__inner) {
  box-sizing: border-box;
  width: 280px;
  height: 39px;
  font-size: 15px;
  border: 1px solid #e0e0e0;
  border-radius: 0px;
  padding: 10px 10px;
  color: #606266;
  outline: 0;
  line-height: 35px !important;
}
</style>
<style lang="scss">
/* 表格 */
.el-table {
  th.el-table__cell > .cell {
    font-size: 16px;
    font-weight: 400;
  }
  .cell {
    font-size: 16px;
  }
}
.el-table tr {
  height: 40px;
}
.el-table thead {
  height: 40px;
}
</style>
